package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @Description
 * @author: shian
 * @date : 2021/1/4
 */
@Getter
public enum CustomerStatementStatusEnum {

    UNCONFIRMED("1", "enum.customerStatementStatus.name.unconfirmed", "unconfirmed"),
    PENDING("2", "enum.customerStatementStatus.name.pending", "pending"),
    CONFIRMED("3", "enum.customerStatementStatus.name.confirmed", "confirmed"),
    ;

    private String code;

    private String name;

    private String attr;

    CustomerStatementStatusEnum(String code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }

    public static CustomerStatementStatusEnum getByCode(String code) {
        for (CustomerStatementStatusEnum value : values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
